import 'package:flutter/material.dart';

class GuanzhuTab extends StatefulWidget {
  const GuanzhuTab({super.key});

  @override
  State<GuanzhuTab> createState() => _GuanzhuTabState();
}

class _GuanzhuTabState extends State<GuanzhuTab> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('关注列表'),
      ),
      
      body: ListView(
        children: <Widget>[
          _buildListItem("沈伊甸", "创作者1"),
          _buildListItem("孙耀宇", "创作者2"),
          _buildListItem("武正乔", "创作者3"),
          _buildListItem("张益铭", "创作者4"),
        ],
      ),
    );
  }

  Widget _buildListItem(String title, String subtitle) {
    return ListTile(
      leading: ClipOval(
        child: Image.asset(
          'lib/assets/logo.png',
          width: 50,
          height: 50,
          fit: BoxFit.cover,
        ),
      ),
      title: Text(
        title,
        style: const TextStyle(
          fontSize: 14,
          fontWeight: FontWeight.w600,
        ),
      ),
      subtitle: Text(
        subtitle,
        style: const TextStyle(
          color: Color.fromARGB(100, 102, 102, 102),
          fontSize: 12,
        ),
      ),
      trailing: Container(
        padding: const EdgeInsets.symmetric(horizontal: 8.0),
        decoration: BoxDecoration(
          border: Border.all(color: Colors.grey, width: 1),
          borderRadius: BorderRadius.circular(4),
        ),
        child: TextButton(
          onPressed: () {
            // TODO: Add functionality for button press
          },
          style: TextButton.styleFrom(
            backgroundColor: Colors.white,
          ),
          child: const Text(
            '已关注',
            style: TextStyle(
              color: Colors.grey,
            ),
          ),
        ),
      ),
    );
  }
}
